package issr.market.decorators;

import javax.servlet.jsp.PageContext;

import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;

public class DecimalDecorator implements DisplaytagColumnDecorator {

	@Override
	public Object decorate(Object arg0, PageContext arg1, MediaTypeEnum arg2)
			throws DecoratorException {
		
		String value = String.valueOf(arg0);
		if(!value.contains(".")) value += ".";
		value += "00";
		String[] values = value.split("\\.");
		values[1] = values[1].substring(0, 2);
		value = values[0]+","+values[1];
		
		return value;
	}

}
